package enterprises

import grails.test.*

class ProviderIntegrationTests extends GroovyTestCase {

	static final String TEST_PROVIDER = "Test Provider"

	static final String TEST_PRODUCT = "Test product"
	
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testSaveProvider() {
		def provider = new Provider(name:TEST_PROVIDER, primaryProduct:TEST_PRODUCT)
		def type = new TypeProvider(name:"LocalTest")
		type.save()
		provider.typeProvider = type
		
		assertNotNull provider.save()
		assertNotNull provider.id
		
		def foundProvider = Provider.get(provider.id)
		
		assertEquals TEST_PRODUCT, foundProvider.primaryProduct
		assertEquals "LocalTest", foundProvider.typeProvider.name
    }
}
